#ifndef __GLF_TASK_TASKBEHAVIOR_IMPL_H_INCLUDED__
#define __GLF_TASK_TASKBEHAVIOR_IMPL_H_INCLUDED__

#include <glf/core/inlines.h>
#include <glf/task/task.h>
#include <glf/task/taskManager.h>

namespace glf {

template<typename Tag>
void TaskDefaultBehavior<Tag>::Push(Task* task, bool signal)
{
	if(TaskManager::GetInstance<Tag>().AreTasksExecutedImmediately())
	{
		task->Run();
		if(task->IsManaged())
		{
			delete task;
		}
	}
	else
	{
		TaskManager::GetInstance<Tag>().Push(task, signal);
	}
}

template<typename Tag>
void TaskBehavior<Tag>::Push(Task* task, bool signal)
{
	TaskDefaultBehavior<Tag>::Push(task, signal);
}

} // end namespace glf


#endif // __GLF_TASK_TASKBEHAVIOR_IMPL_H_INCLUDED__
